/*
 * Copyright (c)  2016, dabing.io
 * All rights reserved.
 * CustomerEntity.java 2017-09-16 上午7:30
 */

package com.ueboot.weishop.entity.customer;

import com.ueboot.weishop.entity.IDEntity;
import com.ueboot.weishop.entity.setting.AreaEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;

import javax.persistence.*;

/**
 * 描述:客户收货地址
 * 每个客户可能存在多个收货地址
 *
 * @author yangkui create on 2017-09-16.
 * @since 1.0
 */
@Data
@NoArgsConstructor
@Entity(name = "WS_CUS_RECEIVER")
public class CustomerReceiverEntity extends IDEntity {
    @Id
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "WS_CUS_RECEIVER")
    @GenericGenerator(name = "WS_CUS_RECEIVER", strategy = "enhanced-table", parameters = {
            @org.hibernate.annotations.Parameter(name = "table_name", value = "WS_TABLE_SEQUENCE"),
            @org.hibernate.annotations.Parameter(name = "segment_value", value = "WS_CUS_RECEIVER"),
            @org.hibernate.annotations.Parameter(name = "optimizer", value = "pooled")})
    @Column(name = "ID", columnDefinition = "INT(20) COMMENT 'id主键'", length = 20)
    private Long id;

    /**
     * 所属区域，到最底级
     */
    @ManyToOne
    @JoinColumn(name="AREA_ID",columnDefinition = "INT(20) COMMENT '所属区域，到最底级'")
    private AreaEntity area;


    /**
     * 所属区域全路径名称
     */
    @Column(name = "AREA_FULL_NAME",columnDefinition = "VARCHAR(200) COMMENT '所属区域全路径名称'",length = 200)
    private String areaFullName;

    /**
     * 省
     */
    @Column(name = "PROVINCE_NAME",columnDefinition = "VARCHAR(200) COMMENT '省'",length = 200)
    private String provinceName;

    /**
     * 市
     */
    @Column(name = "CITY_NAME",columnDefinition = "VARCHAR(200) COMMENT '市'",length = 200)
    private String cityName;

    /**
     * 区
     */
    @Column(name = "AREA_NAME",columnDefinition = "VARCHAR(200) COMMENT '区'",length = 200)
    private String areaName;

    /**
     * 地址
     */
    @Column(name = "ADDRESS",columnDefinition = "VARCHAR(40) COMMENT '地址'",length = 40)
    private String address;
    /**
     * 收件人名
     */
    @Column(name = "CONSIGNEE",columnDefinition = "VARCHAR(40) COMMENT '收件人名'",length = 40)
    private String consignee;
    /**
     * 手机号
     */
    @Column(name = "MOBILE",columnDefinition = "VARCHAR(40) COMMENT '手机号'",length = 40)
    private String mobile;
    /**
     * 邮编
     */
    @Column(name = "ZIP_CODE",columnDefinition = "VARCHAR(40) COMMENT '邮编'",length = 40)
    private String zipCode;
    /**
     * 是否默认
     */
    @Column(name = "DEFAULT_RECEIVER",columnDefinition = "INT(1) COMMENT '是否默认'",length = 1)
    @Type(type= "org.hibernate.type.NumericBooleanType")
    private Boolean defaultReceiver;

    /**
     * 所属客户
     */
    @ManyToOne
    @JoinColumn(name="CUSTOMER_ID",columnDefinition = "INT(20) COMMENT '所属客户'")
    private CustomerInfoEntity customer;

}